FROM python:3.7-slim-buster as base

FROM base as builder

WORKDIR /install

COPY requirements.txt /requirements.txt

RUN echo "Asia/Shanghai" > /etc/timezone && dpkg-reconfigure -f noninteractive tzdata && \
    echo "deb https://mirrors.aliyun.com/debian/ buster main non-free contrib" > /etc/apt/sources.list

RUN apt-get update --fix-missing -o Acquire::http::No-Cache=True

RUN apt-get install -y --no-install-recommends gcc make curl python3-pip

#RUN pip3 install --prefix=/install -U pip setuptools \
#    && pip3 install --prefix=/install -r /requirements.txt \
#    && apt-get remove --purge -y gcc make \
#    && apt-get autoremove -y


FROM base

COPY --from=builder /install /usr/local
COPY . /app
WORKDIR /app


EXPOSE 9999
CMD ["python3","manage.py","runserver"]